package input

import (
	"bytes"
	"log"
	"os"
)

// ShIn Output all the shell input data
func ShIn(flag []string) []byte {
	var in bytes.Buffer
	if len(flag) == 0 {
		in.ReadFrom(os.Stdin)
	} else {
		for _, file := range flag {
			fp, err := os.Open(file)
			if err != nil {
				log.Fatal(err)
			}
			defer fp.Close()
			in.ReadFrom(fp)
		}
	}
	return in.Bytes()
}
